# coding: utf-8
import os
import datetime


class GlobalVars():
    # ---------------- 项目根目录 --------------------
    BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    # ---------------- 隐式等待时间 --------------------
    IMPLICITLY_WAIT_TIME = 10
    # ---------------- 文件上传路径 --------------------
    UPLOAD_FILEPATH = os.path.join(BASE_PATH, "upload")
    # ---------------- 文件下载路径 --------------------
    DOWNLOAD_FILEPATH = os.path.join(BASE_PATH, "download")

    # ---------------- 测试报告 --------------------
    ALLURE_REPORT_NAME = "APP自动化测试报告"
    ALLURE_REPORT_PATH = os.path.join(BASE_PATH, "report")
    ALLURE_RESULT_PATH = os.path.join(ALLURE_REPORT_PATH, "allure_result")
    ALLURE_REPORT_END_PATH = os.path.join(ALLURE_REPORT_PATH, "allure_report")
    # ---------------- 堆栈相关 --------------------
    TRACE_DIR = os.path.join(BASE_PATH, "trace")

    # ---------------- 日志相关 --------------------
    # 日志级别
    LOG_LEVEL = 'debug'
    LOG_STREAM_LEVEL = 'debug'  # 屏幕输出流
    LOG_FILE_LEVEL = 'info'  # 文件输出流
    # 日志命名
    LOG_PATH = os.path.join(BASE_PATH, 'logs')
    LOG_FILE_NAME = os.path.join(LOG_PATH, datetime.datetime.now().strftime('%Y-%m-%d') + '.log')

    # ---------------- 邮件相关 --------------------
    # 邮件文件列表
    FILE_LIST = [
        os.path.join(BASE_PATH, "report", "zip", "report.zip")
    ]

    # ---------------- 压缩文件相关 --------------------
    # 要压缩文件夹的根路径
    REPORT_DIR = os.path.join(BASE_PATH, "report", "allure_report")

    # ---------------- Email相关 --------------------
    EMAIL_FROMADDR = 'xxxxxxxxxx@xx.com'  # 发件人邮箱
    EMAIL_PASSWORD = 'xxxxxxxxxx'  # 发件人授权码
    EMAIL_TOADDR = [  # 收件人地址列表
        'xxxxxxxxxx@qq.com'
    ]

    # ---------------- 截图相关 --------------------
    SCREENSHOT_DIR = os.path.join(BASE_PATH, "screenshot")

    # ---------------- MYSQL配置 -------------------
    MYSQL_CONFIG = {
        "host": "192.168.x.xx",
        "port": 3306,
        "user": "root",
        "password": "xxxxxx",
        "db": "xx",
        "charset": "utf8mb4"
    }

    # ---------------- REDIS配置 -------------------
    REDIS_CONFIG = {
        "host": "192.168.x.xx",
        "port": 6379,
        "password": "xxxxxx",
        "db": "3"
    }


G = GlobalVars()

if __name__ == '__main__':
    print(G.ALLURE_REPORT_END_PATH)
